package com.webproject.service.impl.householdManager;

import java.util.List;

import com.webproject.core.Page;
import com.webproject.dao.householdManager.HouseholdManagerDao;
import com.webproject.entity.householdManager.Complain;
import com.webproject.entity.householdManager.HouseApproval;
import com.webproject.entity.householdManager.Household;
import com.webproject.service.householdManager.HouseholdManagerService;

public class HouseholdManagerServiceImpl implements HouseholdManagerService{

	private HouseholdManagerDao householdManagerDao;
	public HouseholdManagerDao getHouseholdManagerDao() {
		return householdManagerDao;
	}

	public void setHouseholdManagerDao(HouseholdManagerDao householdManagerDao) {
		this.householdManagerDao = householdManagerDao;
	}

	@Override
	public void queryHousehold(Page page) {
		// TODO Auto-generated method stub
		List<Household> households=householdManagerDao.queryHousehold(page);
//		for(Household household:households){
//			household.setBuilding(householdManagerDao.queryBuildingByHousehold(String.valueOf(household.getId())));
//			household.setRoom(householdManagerDao.queryRoomByHousehold(String.valueOf(household.getId())));
//		}
		page.setRows(households);
		page.setRecords(householdManagerDao.queryHouseholdCount(page));
	}

	@Override
	public void saveHousehold(Household household) {
		// TODO Auto-generated method stub
		householdManagerDao.saveHousehold(household);
	}

	@Override
	public void updateHouseHold(Household household) {
		// TODO Auto-generated method stub
		householdManagerDao.updateHousehold(household);
	}

	@Override
	public void queryHouseApproval(Page page) {
		// TODO Auto-generated constructor stub
		page.setRows(householdManagerDao.queryHouseApproval(page));
		page.setRecords(householdManagerDao.queryHouseApprovalCount(page));
	}

	@Override
	public void saveHouseApproval(HouseApproval approval) {
		// TODO Auto-generated constructor stub
		householdManagerDao.saveHouseApproval(approval);
	}

	@Override
	public void updateHouseApproval(HouseApproval approval) {
		// TODO Auto-generated constructor stub
		householdManagerDao.updateHouseApproval(approval);
	}

	@Override
	public void deleteHouseApproval(HouseApproval approval) {
		// TODO Auto-generated constructor stub
		householdManagerDao.deleteHouseApproval(approval);
	}

	@Override
	public void queryComplain(Page page) {
		// TODO Auto-generated method stub
		page.setRows(householdManagerDao.queryComplain(page));
		page.setRecords(householdManagerDao.queryComplainCount(page));
	}

	@Override
	public void saveComplain(Complain complain) {
		// TODO Auto-generated method stub
		householdManagerDao.saveComplain(complain);
	}

	@Override
	public void updateComplain(Complain complain) {
		// TODO Auto-generated method stub
		householdManagerDao.updateComplain(complain);
	}

	@Override
	public void deleteComplain(Complain complain) {
		// TODO Auto-generated method stub
		householdManagerDao.deleteComplain(complain);
	}

}
